﻿<template>
    <div id="app">
        <mt-header v-bind:title="title" style="background-color:#fda10e">
            <a  v-if="backshow==1" slot="left" @click="back()">返回</a>
            <mt-button v-if="right==1" slot="right" @click="rightclick()">{{righttext}}</mt-button>
        </mt-header>
    </div>
  
</template>

<script>
    import Bus from '../bus.js'
    var vm;
    export default {
        name: 'app',
        data() {
            return {
                title: this.headertitle,
                right: this.rightshow,
                backshow: 0,
                righttext: this.righttext1
            }
        },
        props: {
            rightshow: 0,
            righttext1: String,
            headertitle: {
                type: String,
                default: () => ""
            }
        },
        mounted: function () {
           

        },
        methods:
        {
            rightclick: function () {
                if (this.$data.righttext == "设置") {
                    Bus.$emit('val', "hide")
                    Bus.$emit('back', true)
                    this.$router.push('/setting');
                }

            },
            back: function () {
                Bus.$emit('val', "show")
                this.$router.go(-1);
            }

        },
        created() {
            var _this = this;
            // 用$on事件来接收参数
           
            Bus.$on('backshow', (data) => {
               
                console.log("data" + data);
                _this.$data.backshow = data;
              
               
               

            })
        }

    };
</script>

<style scoped>
</style>